﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Slja.BLL;
using Slja.Model;
using FrameWork.web.Web.UC;
using FrameWork.Components;

namespace FrameWork.web.Web.Project.PrintPage
{
    public partial class OrderDetailPrint : System.Web.UI.Page
    {
        protected int OrderID
        {
            get
            {
                return int.Parse(Request.QueryString["orderid"]);
            }
        }
        OrderBLL _bll;
        protected OrderBLL orderBLL
        {
            get
            {
                if (_bll == null) { _bll = new OrderBLL(); }
                return _bll;
            }
        }
        protected OrderExtModel OrderModel
        {
            get
            {
                if (ViewState["_OrderMode"] == null)
                {
                    ViewState["_OrderMode"] = orderBLL.GetModelExt(OrderID, true);
                }
                return (OrderExtModel)ViewState["_OrderMode"];
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            BasicInfo1.Order = OrderModel; BasicInfo1.ControlUsage = DisplayUsage.PrintDisplay;
            WorkTeam1.Order = OrderModel; WorkTeam1.ControlUsage = DisplayUsage.PrintDisplay;
            DesignWork1.Order = OrderModel; DesignWork1.ControlUsage = DisplayUsage.PrintDisplay;
            PriceWork1.Order = OrderModel; PriceWork1.ControlUsage = DisplayUsage.PrintDisplay;
            OrderLog1.OrderID = OrderModel.ID; OrderLog1.ControlUsage = DisplayUsage.PrintDisplay;
        }
        protected override void OnPreRender(EventArgs e)
        {
            OrderSectionBase sec = null;
            for (int i = 0; i < DIVContainer.Controls.Count; i++)
            {
                sec = DIVContainer.Controls[i] as OrderSectionBase;
                if (sec != null && sec.OpRight == Components.OpRightState.Hidden)
                {
                    sec.Visible = false;
                }
            }
            base.OnPreRender(e);
        }
    }
}